clear all
cd "C:\Users\"
log using "Four Signalling Mechanisms", replace
insheet using “signalmech.csv", clear

** Remove disqualified respondents **

// Refuse to participate
drop if waiver == 2             

// Age less than 18 years old (i.e. born after 1999 ["2"])
drop if yob < 2                 

// Non-American citizen
drop if citizen != 1            

// Withdrew before finishing survey
drop if end != 1                

/* 
Variables summary
IV: mech (1 = Experiment 1: Sunk cost signal,   n = 427
          2 = Experiment 2: Tied-hands signal,  n = 430
		  3 = Experiment 3: IC signal,          n = 423
		  4 = Experiment 4: RC signal)          n = 427
		  
    cost ( 0 = costless signals,
	       2 = low-cost signals,
		  10 = high-cost signals)

DV: opinion (generated from `fulfil' (Q1) and 
				`fulfil1', `fulfil2', and `fulfil3' (Q2))
			Subtracted by one to convert into [0,6] scale
						 
Statistical Tests:
	t-test, within each group, across each `cost' value
*/ 

** Generate DV **
gen opinion = .
replace opinion = fulfil1 if fulfil == 1 
replace opinion = fulfil2 if fulfil == 2
replace opinion = fulfil3 if fulfil == 3

replace opinion = opinion - 1

** Summary statistics **
gen credible = .
replace credible = 1 if opinion == 4 | opinion == 5 | opinion == 6
replace credible = 0 if opinion == 0 | opinion == 1 | opinion == 2 | opinion == 3

// Displays proportion of respondents in Experiment 1 who found the threat credible
tab cost credible if mech == 1, row

** t-tests **

foreach i of num 1/4 {
    display "Experiment " + `i'
	ttest opinion if (cost == 0 | cost ==  2) & mech == `i', by(cost)
	ttest opinion if (cost == 0 | cost == 10) & mech == `i', by(cost)
	ttest opinion if (cost == 2 | cost == 10) & mech == `i', by(cost)
}

log close